package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import news.dao.impl.*;
import news.entity.*;

public class ShowServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public ShowServlet() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts

		// "destroy" string in log
		// Put your code here
	}

	public void doGet(HttpServletRequest

	request, HttpServletResponse response) throws ServletException,

	IOException {
		this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		TopicDaoImpl td = new TopicDaoImpl();
		List<Topic> tp = td.getAllTopics();
		request.setAttribute("List", tp);
		request.getRequestDispatcher("/modifyTopic.jsp").forward(request,
				response);

	}

	public void init() throws ServletException

	{
		// Put your code here
	}

}
